[ Mega Script Archive ] [ Frequently Asked Questions ] [ Countdown ]

Can I in-line this into a current Web Page?

Yep! Only it takes a little more effort than the change shown in the previous question.

First, find the subroutine html_header which looks like:

   sub html_header {
      print "Content-type: text/html\n\n";
      print "<html><head><title>Countdown to: $date_term</title>
             </head>\n";
      print "<body><center><h1>Countdown to: $date_term</h1>\n";
      print "<hr>\n";
   }

Now, change this to:

   sub html_header {
      print "Content-type: text/html\n\n";
   }

This gets rid of all of the html, body, head, center, and header tags. Now you will need to do a similar thing to the html_trailer subroutine. Change it from:

   sub html_trailer {
      print "<hr>\n";
      print "It is currently $current_date\n";
      print "</center>\n";
      print "</body></html>\n";
   }

To contain no statements, like:

   sub html_trailer {
   }

Now, all that the sript will output is the countdown time However, each time amount (year, month, etc.) will be separated by <br> tags. To change this, find the proper_english subroutine, and change all of the <br> references to ", " (without the quotes).

Now, all that is left is in-lining this into your web page. This requires the use of Server Side Includes. If you can use them, you will probably have to rename your file from filename.html to filename.shtml so the server knows to parse the file. Then include a reference like the following for your countdown to appear:

   <!--#exec cgi="/url/path/to/countdown.pl"-->

And it's as easy at that!


[ Mega Script Archive ]